// review-complete.js
Component({
  properties: {
    reviewStats: {
      type: Object,
      value: {
        total: 0,
        mastered: 0
      }
    },
    reviewTime: {
      type: Number,
      value: 0
    },
    completionBonus: {
      type: Number,
      value: 0
    },
    animationData: {
      type: Object,
      value: {}
    }
  },

  methods: {
    // 再复习一次
    reviewAgain: function() {
      this.triggerEvent('reviewagain');
    },
    
    // 返回首页
    goHome: function() {
      this.triggerEvent('gohome');
    },
    
    // 格式化复习时间
    formatReviewTime: function() {
      const minutes = Math.floor(this.properties.reviewTime / 60);
      const seconds = this.properties.reviewTime % 60;
      return `${minutes}:${seconds < 10 ? '0' + seconds : seconds}`;
    },
    
    // 计算掌握率
    calculateMasteryRate: function() {
      if (this.properties.reviewStats.total === 0) return 0;
      return Math.round((this.properties.reviewStats.mastered / this.properties.reviewStats.total) * 100);
    }
  }
});